﻿using System;
using Platformer_Example.Controller.Character;
using Transformable_Engine_v2.Engine.Transformable_Math.Geometry;

namespace Platformer_Example.Controller.Map
{
    public class Warp
    {
        public Warp(string data)
        {
            var elements = data.Split(' ');

            WarpArea = new TE_Rectangle(Convert.ToSingle(elements[1]), Convert.ToSingle(elements[2]),
                                        Convert.ToSingle(elements[3]), Convert.ToSingle(elements[4])).ToGridBound();
             
            TargetArea = new MapPlayerData(elements[5],
                                           new TE_Vector2(Convert.ToSingle(elements[6]), Convert.ToSingle(elements[7])),
                                           (BaseInputCharacter.State)
                                           Enum.Parse(typeof (BaseInputCharacter.State), elements[8]),
                                           (BaseInputCharacter.Direction)
                                           Enum.Parse(typeof (BaseInputCharacter.Direction), elements[9]));
        }

        public TE_Rectangle WarpArea { get; private set; }
        public MapPlayerData TargetArea { get; private set; }
    }
}